#include<iostream>
#include<cmath>
using namespace std;

int main() {
	int n, i, j, a[11][11];
	cin >> n;
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	
	for (i = 0; i < n; i++) {
		for (j = i; j < n; j++) {
			if (a[i][j] != a[j][i]) {
				cout << "No";
				return 0;
			}
		}
	}
	cout << "Yes";
}
